package com.isias.system.Controller;
import com.isias.common.result.Result;
import com.isias.model.system.SysOperLog;
import com.isias.model.vo.SysOperLogQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.isias.system.service.Operlogservice;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping(value="/admin/system/sysOperLog")
@SuppressWarnings({"unchecked", "rawtypes"})
public class SysOperLogController {

    @Resource
    private Operlogservice operlogservice;

    @GetMapping("{page}/{limit}")
    public Result index(@PathVariable Long page, @PathVariable Long limit, SysOperLogQueryVo sysOperLogQueryVo) {
        Page<SysOperLog> pageParam = new Page<>(page, limit);
        IPage<SysOperLog> pageModel = operlogservice.selectPage(pageParam, sysOperLogQueryVo);
        return Result.ok(pageModel);
    }

    @GetMapping("{id}")
    public Result get(@PathVariable Long id) {
        SysOperLog sysOperLog = operlogservice.getById(id);
        return Result.ok(sysOperLog);
    }
}
